<form id="user-set-form" action="user/updateSet" data-interceptor="_interceptor_user_set" class="form-horizontal bv-form" method="post" role="form">
<div class="row">
	<div class="col-sm-9">	
	<div class="form-group">
		<label for="model.code" class="col-sm-2 control-label">登录账号</label>
		<div class="col-sm-4 control-text">
			#(model.code)
		</div>
		<label for="model.orgId" class="col-sm-2 control-label">所属机构</label>
		<div class="col-sm-4 control-text">
			#(session.SESSION_USER.attrs.orgName??)
		</div>
	</div>
	<div class="form-group">
		<label for="model.name" class="col-sm-2 control-label">用户名称</label>
		<div class="col-sm-4">
			<input id="model.name" name="model.name" value="#(model.name)" placeholder="用户名称" class="form-control input-md" required maxlength="64"/>
		</div>
		<div class="col-sm-offset-2 col-sm-4">
			<div class="checkbox checkbox-warning">
			<input id="updatePwd" name="updatePwd"  value="true"  type="checkbox" onclick="_updatePwd(this.checked);">
			<label for="updatePwd" class="checked">修改密码</label>
			</div>
		</div>
	</div>

	<div class="form-group div_pwd" style="display:none;">
		<label for="old_pwd" class="col-sm-2 control-label">当前密码</label>
		<div class="col-sm-4">
			<input id="old_pwd" name="old_pwd" value="" placeholder="当前密码" class="form-control input-md" maxlength="16" type="password"/>
		</div>
	</div>
	<div class="form-group div_pwd" style="display:none;">
		<label for="model.pwd" class="col-sm-2 control-label">新密码</label>
		<div class="col-sm-4">
			<input id="model.pwd" name="model.pwd" placeholder="新密码" class="form-control input-md" maxlength="16" type="password"/>
		</div>
		<label for="repeat_pwd" class="col-sm-2 control-label">确认密码</label>
		<div class="col-sm-4">
			<input id="repeat_pwd" name="repeat_pwd" placeholder="确认密码" class="form-control input-md" maxlength="16" type="password"/>
		</div>		
	</div>	
	
	<div class="form-group">
		<label for="model.tel" class="col-sm-2 control-label">电话号码</label>
		<div class="col-sm-4">
			<input id="model.tel" name="model.tel" value="#(model.tel)" placeholder="电话号码" class="form-control input-md" maxlength="32"/>
		</div>
		<label for="model.mobile" class="col-sm-2 control-label">手机号码</label>
		<div class="col-sm-4">
			<input id="model.mobile" name="model.mobile" value="#(model.mobile)" placeholder="手机号码" class="form-control input-md" maxlength="32"/>
		</div>
	</div>
	
	<div class="form-group">
		<label for="model.email" class="col-sm-2 control-label">电子邮件</label>
		<div class="col-sm-4">
			<input id="model.email" name="model.email" value="#(model.email)" placeholder="电子邮件" class="form-control input-md" maxlength="32" type="email"/>
		</div>
		<label for="model.card" class="col-sm-2 control-label">身份证</label>
		<div class="col-sm-4">
			<input id="model.card" name="model.card" value="#(model.card)" placeholder="身份证" class="form-control input-md" maxlength="32"/>
		</div>
	</div>
	
	<div class="form-group">
		<label for="model.remark" class="col-sm-2 control-label">用户描述</label>
		<div class="col-sm-10">
			<textarea id="model.remark" name="model.remark" placeholder="描述" class="form-control input-md" maxlength="1024">#(model.remark)</textarea>
		</div>
	</div>
	</div>
	<div class="col-sm-3" style="padding: 20px 0 0 15px;">
		<input id="user_photo" name="user_photo" data-title="头像" data-data-id="#(model.id)" data-image="true"  data-file-num-limit="1" data-callback="" class="auto-file"/>
	</div> 
 </div>	
</form>
<script type="text/javascript">
	function _updatePwd(flag){
		var pwd=jid("model.pwd");
		if(flag){
			$(".div_pwd").show();
			$("#user-set-form").bootstrapValidator("addField","old_pwd",{  
                validators: {  
                    notEmpty: {  
                        message: '当前密码不能为空'  
                    }
                }  
            });
			$("#user-set-form").bootstrapValidator("addField",pwd,{  
                validators: {  
                    notEmpty: {  
                        message: '新密码不能为空'  
                    },  
                    stringLength: {  
                        min: 6,  
                        max: 12,  
                        message: '密码长度为6到12位字符'  
                    }
                }  
            });
			$("#user-set-form").bootstrapValidator("addField","repeat_pwd",{  
                validators: {  
                	identical: {
                        field: 'model.pwd',
                        message: '两次密码不同请重新输入'
                    }
                }  
            });
		}else{
			$(".div_pwd").hide();
			$("#user-set-form").bootstrapValidator("removeField",pwd);
			$("#user-set-form").bootstrapValidator("removeField","old_pwd");
			$("#user-set-form").bootstrapValidator("removeField","repeat_pwd");
		}
	}
	function _interceptor_user_set(){
		var old_pwd=$("#old_pwd");
		var repeat_pwd=$("#repeat_pwd");
		var pwd=jid("model.pwd");
		return true;
	}
	
	$(document).ready(function() {
	});
</script>